package com.artPreter.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 主机表
 * </p>
 *
 * @author Jarvis_He
 * @since 2024-04-22
 */
@Getter
@Setter
@TableName("jv_main_device")
public class MainDevice implements Serializable {

    private static final long serialVersionUID = 1L;

    //ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    //主机uuid")
    @TableField("uuid")
    private String uuid;

    //创建时间")
    @TableField("create_time")
    private Integer createTime;

    //排序")
    @TableField("sort")
    private Integer sort;

    //备注")
    @TableField("remarks")
    private String remarks;

    //IP第一位")
    @TableField("place1")
    private Integer place1;

    //IP第二位")
    @TableField("place2")
    private Integer place2;

    //IP第三位")
    @TableField("place3")
    private Integer place3;

    //IP第四位")
    @TableField("place4")
    private Integer place4;

    //启用：1 禁用:0")
    @TableField("status")
    private Integer status;

    //房间id")
    @TableField("room")
    private String room;

    //楼层id")
    @TableField("floor")
    private String floor;

    //区域id")
    @TableField("position")
    private String position;

    //使用设备id")
    @TableField("device_id")
    private String deviceId;

    //使用设备名称")
    @TableField("device_name")
    private String deviceName;

    public MainDevice() {
    }

    public MainDevice(MainDevice mainDevice, Integer mode) {
        switch (mode){
            // 编辑
            case 1:
                this.sort = mainDevice.getSort();
                this.remarks = mainDevice.getRemarks();
                this.place1 = mainDevice.getPlace1();
                this.place2 = mainDevice.getPlace2();
                this.place3 = mainDevice.getPlace3();
                this.place4 = mainDevice.getPlace4();
                this.status = mainDevice.getStatus();
                this.room = mainDevice.getRoom();
                this.floor = mainDevice.getFloor();
                this.position = mainDevice.getPosition();
                this.deviceId = mainDevice.getDeviceId();
                this.deviceName = mainDevice.getDeviceName();
                break;
            // 启用/禁用
            case 2:
                if(mainDevice.getStatus()==1){
                    this.status = 0;
                }else if(mainDevice.getStatus()==0){
                    this.status = 1;
                }
                break;
        }
    }
}
